
<div class="row">
    <div class="container-fluid">
        <div class="col-lg-12 no-padding">
            <section class="content-header">
                <ol class="breadcrumb">
                    <li><a href="#"><i class="fa fa-dashboard"></i> 首页</a></li>
                    <li><a href="#" class="active">我下载的文件</a></li>
                </ol>
            </section>
            <!-- Main content -->
            <section class="content">
                <div class="row">
                    <div class="col-lg-12 no-padding">
                        <div class="jax-box jax-box-table">

                            <table id="table" class="table table-striped">

                            </table>
                        </div>
                    </div>
                </div>
            </section>

        </div>
    </div>
</div>
<script>

    /* * *权限标识 */
    var downloadFlag = "[[${@perms.hasPerm('download:check_yes')}]]";//下载我的文件

    /* // 查询、表格 Start*/
    $(function () {

        window.operateEvents  = {
            'click .btn_download': function (e, value, row, index) {
                let id = row.id;
                layer.msg("正在生成压缩文件",{time:1000},function () {
                    Core.postAjax("/download/check_yes",{"id":id},function (data) {
                        if(data["data"]){
                            $("<form></form>").attr("action", "/download/"+data["data"]).attr("method", "post")
                           // .append($("<input>").attr("type", "hidden").attr("name", "path").attr("value", data["data"]))
                            .appendTo('body').submit().remove();
                        }else {
                            layer.msg("文件未审核")
                        }
                    },"get","application/json");
                })
            }
        };
        let columns = [
            {
                field: 'downloadNumber',
                title: '申请ID',
                width:60,
                align:"center"

            }
            ,
            {

                title: '文件',
                align:"left",
                formatter:function (value, row, index) {
                    var rs = (
                        row['fileInfoList'].map(function (value,i) {
                            return value['fileName']+"<br>";
                        })
                    ).join("");
                    return rs;
                },

            },
            {
                field: 'applicationTime',
                title: '申请时间',
                align:"center",
                width:100,
                align:"center"

            },
            {
                field: 'zipPassword',
                title: '解压密码',
                align:"center",
                width:60,

            },
            {
                title: '审核人/时间',
                align:"center",
                formatter:function (value, row, index) {
                    return  (row.status!=0?(row.checkerName+"/"+row.checkTime):"");
                },
                width:160,
            },
            {
                field: 'status',
                title: '审核结果',
                width: 100,
                align:"center",
                formatter: function (value, row, index) {
                    if (value == 0) {return "未审核"}
                    return '<a href="javascript:void(0)" ' + (value == 2 ? "style='color:red'" : "")
                        + (row.checkRemark ? ('data-toggle="tooltip" data-placement="top" title="' + row.checkRemark) : "")// 审核备注
                        + '">'
                        + "<i class=\"fa " + (value == 1 ? "fa-check" : "fa-close") + "\"></i>" //图标
                        + (value == 1 ? "通过" : "拒绝") //文字内容
                        + '<a/>';
                }
            },
            {
                title: '下载',
                width: 80,
                align:"center",
                formatter:function (value, row, index) {
                    var btn = (downloadFlag=="true"?'<a class="table-btn table-btn-success btn_download" href="javascript:;"><i class="fa fa-download"></i>下载</a>':"");
                    return (row.status==1?btn:"");
                },
                events:window.operateEvents
            }

        ];
        let options={
            id:"#table",
            url: '/download/list-my',
            method:'get',
            columns:columns,
            showRefresh: true,
          //  sortable:true,
            pageList: "[10, 25, 50, 100, all]",
            queryParams : queryParams
        }
        Core.initTable(options);

        /*查询参数*/
        function queryParams(params) {
            return {
                limit : params.limit, //页面大小
                pageNo : (params.offset/params.limit)+1, //页码
            };
        }
    });
    /* // 查询、表格 End */



</script>
